package drds.common.db.xml_mapping.executor;

import drds.common.db.xml_mapping.mapping.Mapper;

import java.util.ArrayList;
import java.util.List;


public class BatchResult {

  private final Mapper MappedStatement;
  private final String sql;
  private final List<Object> parameterObjects;

  private int[] updateCounts;

  public BatchResult(Mapper MappedStatement, String sql) {
    super();
    this.MappedStatement = MappedStatement;
    this.sql = sql;
    this.parameterObjects = new ArrayList<>();
  }

  public BatchResult(Mapper MappedStatement, String sql, Object parameterObject) {
    this(MappedStatement, sql);
    addParameterObject(parameterObject);
  }

  public Mapper getMappedStatement() {
    return MappedStatement;
  }

  public String getSql() {
    return sql;
  }

  @Deprecated
  public Object getParameterObject() {
    return parameterObjects.get(0);
  }

  public List<Object> getParameterObjects() {
    return parameterObjects;
  }

  public int[] getUpdateCounts() {
    return updateCounts;
  }

  public void setUpdateCounts(int[] updateCounts) {
    this.updateCounts = updateCounts;
  }

  public void addParameterObject(Object parameterObject) {
    this.parameterObjects.add(parameterObject);
  }

}
